Summary terminal value to makefile, how to pass? Simply enter the following command at the terminal, then you can safely use the $ (ABCDE) variable in the makefile file, which has a value of BBBMakefileFun.h#include class Test {public: void static display(const char *str);};Fun.cpp#include "fun.h"void Test::display(const char *str) { std::cout Main.cpp#include "fun.h"int main() {#if defined AAA Test::dis
Recently in learning Linux under the C programming, bought a called "Linux environment in the C Programming Guide" read to makefile more and more confused, may be my understanding can not.
So Google came to the following article. Plain and easy to understand. Then post it for easy learning.
PostScript, read this article and the "Linux environment in the C Programming Guide," The makefile chapter of the asto
Makefile and makefile
At first, I will intercept a piece of nonsense about how to learn makefile. If you don't want to listen, please jump directly to my makefile tutorial.
First of all, we must first explain that learning makefile is really a painful process, especially the
I. What is in Makefile?
Makefile mainly contains five things:Explicit rules,Concealed rules,Variable definition,File indicationAndNote.
1,Explicit rules: Explicit rules demonstrate how to generate one or more target files. This is clearly pointed out by Makefile writers that the files to be generated, the dependent files of the files, and the generated commands.
[LINUX Network Programming] Makefile and network programming makefile
Some Reading Notes in Chapter 2nd of Linux Network Programming (version 2)
Makefile: defines a series of rules in a project that contains a large number of files to specify the sequence of compiled files, which can be used to manage projects.
Makefile
program into modules, which were decomposed into different files. When one of these parts changes, because the other file's target source file already exists, so the compiler does not need to compile all the code to generate a new executable file, and only need to compile the changed source files, and then connect all the target files on it, which is very important in the large project development, This can reduce the compilation time from several hours to a few minutes. That's what make can do
Makefile Learning (3) [version 2] And makefile learning Version 2Common embedded functions of make
1. function call
$ (Function arguments) # $ the referenced result is the result generated by the function.
2. Common functions in Makefile
1) $ (wildcard PATTERN) # match the files in the current directory
For example, src = $ (wildcard *. c) # Matches all. c files
Linux driver development kernel module compilation-Makefile getting started tutorial, driver development makefile
I. Module Compilation
In the previous kernel compilation, we mentioned that driver compilation is dividedStatic CompilationAndDynamic CompilationStatic compilation is to directly compile the driver into the kernel, and dynamic compilation is to compile the driver into a module.
Dynamic compilat
Tags: blog Io ar SP file on 2014 Take a set of simple. c files as an example. The learning process from compiling commands to makefile. The GCC parameters are not described too much. The following files and content: Add. c int add(int a int b){ return a+b;} Sub. c int sub(int a ,int b){ return a-b;}Cal. h #ifndef __CAL_H_#define __CAL_H_int add(int,int);int sub(int,int);#endif Main. c #include There are three source files
By default, make will look for the makefile file to read and execute in the file name order in the working directory (the directory where the make is executed), looking for the file name in the following order: "Gnumakefile", "Makefile", "makefile".Usually you should use "makefile" or "
Lesson 3 make Makefile (I) and make makefilePreface:
The previous course explains the gcc compilation process to its practice. You can see that some of these steps can simplify compilation, however, due to the large number of parameters and the large number of files in the project, errors may occur, or even a lot of time is wasted on compilation. Therefore, this tool is also available in the linux system: makefile.Principle:
In fact, the essence of
Objective:You don't need to edit a slightly obscure makefile file when you build a C + + program using VS on Windows, and for starters, they don't even realize it's there. VS is to automatically generate makefile files and build the project. There is no denying that Visual Studio is an all-purpose IDE, it helps developers do a lot of work, but also reduce the threshold of the C + +, the significance is very
Use Makefile to optimize the entire process of Makefile
Take a set of simple. c files as an example. The learning process from compiling commands to Makefile.
The gcc parameters are not described too much. The following files and content:
Add. c
int add(int a int b){ return a+b;}
Sub. c
int sub(int a ,int b){ return a-b;}
Cal. h
#ifndef __CAL_H_#defi
Assign values to variables in Makefile and assign values to makefile
Variable assignment in Makefile
BEIJING-Haidian District
First, the Makefile syntax is as follows:
Targets: prerequisites
Command
.........
Or:
Targets: prerequisites; command
Command
.........
Targets is a file name separated by spaces. Wildcards c
Linux study note 6. makefile file manager and makefile file creation-Linux general technology-Linux programming and kernel information. For details, see the following. Splitting source program files is conducive to developing large programs and improving the efficiency of programming. But the more files are separated, the more compilation and Maintenance
Difficult. To prevent changes to one or more files i
Makefile condition judgment ---------- [Badboy], makefile condition badboy
Conditional judgment allows make to select different execution branches based on different running conditions. A conditional expression can be used to compare the value of a variable or a constant.
I. Example
In the following example, determine whether the $ (CC) variable is "gcc". If yes, use the GNU function to compile the target.
Finally, C ++ code porting was introduced to bootloader. The only achievement was familiarity with makefile. Some factory companies could not afford to be hurt. Every time they had to do something to meet the needs of factory-side testing, in order to be able to meet the requirements of the factory for testing in Boot, after discussion with the chip company, only C ++ can be obtained to boot, it is really a second decision that boot will eventually ac
When the make command executes, a makefile file is required to tell the make command how to compile and link the program.First, we use an example to illustrate Makefile's writing rules. In order to give everyone a perceptual knowledge. This example comes from the GNU Make manual, in which we have 8 C files, and 3 header files, and we're going to write a makefile to show how the Make command compiles and lin
Makefile topic: Automatic Generation of dependency (I), makefile topic1. Problem Introduction
1) Does the target file (. o) only depend on the source file (. c )?2) How does the compiler compile source files and header files?2. defects caused by compilation behaviors Preprocessor transfers the code in the header file
Insert directlyTo the source file compiler, you can only use
The source file after preproce
.
| -- Makefile
| -- Test1
| -- Makefile
| -- Bin
| '-- Test
| -- Hello. o
| -- Include
| '-- Hello. h
| '-- SRC
| '-- Hello. c
'-- Test2
| -- Makefile
| -- Bin
| '-- Test
| -- Hello. o
| -- Include
| '-- Hello. h
| -- OBJ
'-- SRC
'-- Hello. c
The makefile in the root directory calls the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.